<?php defined( '_VALID_MOS' ) or die( 'Restricted access' );?>
<?php
global $mosConfig_absolute_path, $mosConfig_live_site, $mosConfig_lang, $message_login, $my;

if (file_exists( $mosConfig_absolute_path.'/components/com_jcs/languages/'.$mosConfig_lang.'.php' ))
    include( $mosConfig_absolute_path.'/components/com_jcs/languages/'.$mosConfig_lang.'.php' );
else
    require( $mosConfig_absolute_path.'/components/com_jcs/languages/english.php' );

$r_url = mosGetParam( $_REQUEST, 'r_url', '' );
//$itemid = mosGetParam($_REQUEST, 'Itemid');
Global $Itemid;
?>
<table class="contentpanopen" width="100%">
  <TR>
    <td class="componentheading">
    <?php echo $JCS_TITLE_GET; ?>
    </td>
  </TR>
</table>
<div class="contentpaneopen">
<?php 
if($my->id){
?>
<p>
  <a href="<?php echo sefRelToAbs('index.php?option=com_jcs&amp;Itemid='.$Itemid)?>"><?php echo $JCS_HISTORY;?></a>
</p>
<?php 
}
if($msg) echo "<p><h3>$msg</h3></p>"; ?>

<p><?php if($my->id) echo $JCS_TITLE_GET_DES; else echo JCS_WELCOME;?></p>
<FORM action="<?php echo $mosConfig_live_site; ?>/index.php" method="post">

<?php
$k=0;
$r=0;
foreach($rows AS $k => $row)
{

    if($rows[$k-1]->catid != $row->catid)
    {
        if($rows[$k-1]->catid) echo "</table></div>";
    ?>
      
      <DIV class="contentheading">
          <?php echo $row->cname?>
      </DIV>
      <DIV class="contentpanopen">
      <P><?php echo $row->cdescr;?></P>
      <table cellpadding="5" cellspacing="0" border="0">
    <?php 
    }
    ?>
    
    
    <?php
    $nprice = '';
    if(($row->one_time > 0) && in_array($row->id, $plans))
    {
      continue;
    }
    if(($row->discount > 0) && in_array($row->id, $plans) && ($row->price > 0))
    {
        $nprice = $row->price - (($row->price / 100) * $row->discount);
        $nprice = number_format($nprice, 2, '.', '' ); 
    }
    ?>
    <tr valign="top" class="sectiontableentry<?php echo $r+1?>">
      <?php if($my->id){?><td width="1%"><INPUT type="radio" <?php if(!$ch){echo 'checked="checked"'; $ch++;}?> name="stype" id="<?php echo $row->id; ?>" value="<?php echo $row->id; ?>" /></td><?php }?>
      <TD nowrap="nowrap" width="1%"><?php 
      if($row->days > 100 && $row->days_type == 'years')
      echo JCS_LIFETIME;
      else
      {
      echo $row->days.' '; 
      echo ucfirst($row->days_type); }?></TD>
      <td><b><?php echo $row->name; ?></b><P><?php echo $row->description; ?></P></td>
      <td align="right" nowrap="nowrap">
      <B><big><?php echo $nprice ?  '<S style="color:red;text-decoration:line-through " >'.JEConfig::get('general.curr').' '.$row->price.'</S><BR> '.JEConfig::get('general.curr').' '.$nprice : JEConfig::get('general.curr').' '.$row->price?> 
      </big></B>
      <INPUT type="hidden" name="price<?php echo $row->id ?>" value="<?php echo $nprice ? $nprice : $row->price;?>" /></td>
    </tr>
<?php
  $r = 1 - $r;
}
?>
                  
        </table>
        </div>
   
    
    
<DIV class="contentpanopen">
<?php If($coupons && $my->id)
{
 ?>
<P><?php echo JCS_COUPONS;?></P>
<INPUT type="text" size="40" name="coupon" class="inputbox" value="<?php echo mosGetParam($_REQUEST, 'coupon')?>" />
<?php 
}
if($my->id){
 ?>
<p><?php echo $JCS_CHOOSE_PAY;?></p>

<p><?php echo jeMakePayProcessor($type='radio');?></p>
<INPUT type="submit" class="button" value="<?php echo $JCS_BUTTON_S?>"/>
<?php 
}
?>
 </DIV>



<input type="hidden" name="task" value="addsubscription">
<input type="hidden" name="option" value="com_jcs">
</FORM>
</div>
<BR>
<BR>
